#
# @lc app=leetcode.cn id=3 lang=python3
#
# [3] 无重复字符的最长子串
#

# @lc code=start
class Solution:
    def lengthOfLongestSubstring(self, s: str) -> int:
        if s == "":
            return 0
        max_substr_len = 1
        for index, t in enumerate(s):
            sub_str = []
            sub_str.append(t)
            for next_str in s[index + 1 :]:
                if next_str not in sub_str:
                    sub_str.append(next_str)
                else:
                    break
            if max_substr_len < len(sub_str):
                max_substr_len = len(sub_str)

        return max_substr_len


# @lc code=end

if __name__ == "__main__":
    solution = Solution()
    _len = solution.lengthOfLongestSubstring("aub")
    print(_len)